//
//  EvaluationTeacherCell.h
//  CommunityNannyO2O
//
//  Created by apple on 15/8/13.
//  Copyright (c) 2015年 Apple. All rights reserved.
//

#import "EvaluationTeacherCell.h"
#import "APIAdress.h"
#import "MBProgressHUD+YC.h"
#import "MJExtension.h"
#import "AccountTool.h"
#import "UIViewController+Create.h"
#import "CustomTextField.h"
#import "AppConfig.h"
#import "EvaluationTeacherCell.h"
#import "QXNetWorkTool.h"
#import "UserDataSingleton.h"
#import "UIImageView+WebCache.h"

@interface EvaluationTeacherCell()<UITextViewDelegate>

@property (weak, nonatomic) IBOutlet UILabel *midiId;
@property (weak, nonatomic) IBOutlet UIImageView *myIco;
@property (copy, nonatomic) NSString *placeHolder;

@end

@implementation EvaluationTeacherCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"EvaluationTeacherCell";
    EvaluationTeacherCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        
        cell = [[[NSBundle mainBundle] loadNibNamed:ID owner:nil options:nil]firstObject];
        
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    
    return cell;
}

-(void)awakeFromNib
{
    [self.myIco sd_setImageWithURL:[NSURL URLWithString:[UserDataSingleton shareInstance].head_img]];
    
    self.midiId.text = @"Midi ID:";
    self.midiId.text = [self.midiId.text stringByAppendingString:[UserDataSingleton shareInstance].midi_id];
    
    self.content.delegate = self;
    [self.content.layer setBorderWidth:1.0]; //边框宽度
    [self.content.layer setBorderColor:UIColorRGBA(216, 216, 216, 1).CGColor];//边框颜色
    
    self.commit.layer.cornerRadius = 10;
    self.commit.layer.masksToBounds = YES;
    [self.commit.layer setBorderWidth:1.0]; //边框宽度
    
    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)];
    
    [self addGestureRecognizer:tapGestureRecognizer];
    
    self.placeHolder = @"点击编辑评价";
}

-(void)tap
{
    [self.content resignFirstResponder];
}

- (void)textViewDidBeginEditing:(UITextView *)textView
{
    textView.text = @"";
}

- (void)textViewDidEndEditing:(UITextView *)textView
{
    if ([textView.text isEqualToString:@""])
    {
        textView.text = self.placeHolder;
    }
}

- (IBAction)commite:(id)sender
{
    if ([self.delegate respondsToSelector:@selector(commite:Content:)]) {
        
        [self.delegate commite:self.teacher_id  Content:self.content.text];
    }
}



@end




















